package com.huawei.springboot2023;

import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;

@MapperScan("com.huawei.springboot2023.business.**.mapper")// mapper接口所在的包
@SpringBootApplication
public class Springboot2023Application {

    //分页配置
    @Bean
    public MybatisPlusInterceptor mybatisPlusInterceptor() {
        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));// 分页的方法-以mysql分页方式实现
        return interceptor;
    }

    public static void main(String[] args) {
        SpringApplication.run(Springboot2023Application.class, args);
    }

}
